package com.project.service.impl;

import java.util.List;
import java.util.Map;

import com.project.entity.Expert;
import com.project.entity.ExpertExample;
import com.project.entity.ExpertProject;
import com.project.mapper.ExpertMapper;
import com.project.service.ExpertManage;
import com.project.mapper.ExpertProjectMapper;

public class ExpertManageService implements ExpertManage {
	private ExpertMapper expertMapper;
	private ExpertProjectMapper expertProjectMapper;
	

	
	public ExpertProjectMapper getExpertProjectMapper() {
		return expertProjectMapper;
	}

	public void setExpertProjectMapper(ExpertProjectMapper expertProjectMapper) {
		this.expertProjectMapper = expertProjectMapper;
	}

	public ExpertMapper getExpertMapper() {
		return expertMapper;
	}

	public void setExpertMapper(ExpertMapper expertMapper) {
		this.expertMapper = expertMapper;
	}
	

	public int countAllResultingExpert(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this.expertMapper.countAllResultingExpert(map);
	}

	public List<Expert> getAllResultingExpert(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this.expertMapper.getAllResultingExpert(map);
	}
	

	public int countProjectInvolved(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this.expertProjectMapper.countProjectInvolved(map);
	}

	public List<ExpertProject> getProjectInvolved(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this.expertProjectMapper.getProjectInvolved(map);
	}

	//通过身份证信息查找专家
	public Expert findByIDCart(String idCart) {
		ExpertExample example = new ExpertExample();
		example.or().andIdentitycardnumberEqualTo(idCart);
		List<Expert> tmp = this.expertMapper.selectByExample(example);
		Expert expert = tmp.get(0);
		return expert;
	}

	//获得全部专家库记录
	public List<Expert>getAllExpert(Integer start , Integer end) {
		ExpertExample example = new ExpertExample();
		return this.expertMapper.selectByExample(example);
	}

	//添加记录
	public void insertExpert(Expert expert) {
		this.expertMapper.insert(expert);
	}
	
	//通过主键ID查找专家信息记录
	public Expert findById(Integer id){
		return this.expertMapper.selectByPrimaryKey(id);
	}
	
	//通过主键ID修改指定专家的信息
	public void updateById(Expert expert){
		this.expertMapper.updateByPrimaryKey(expert);
	}
	
	//通过主键ID删除指定专家的信息
	public void deleteById(Integer expertId){
		this.expertMapper.deleteByPrimaryKey(expertId);
	}
}
